<template>
	<view class="container">
		<!-- 电子处方 -->
		<view class="common-card" v-for="item in dataList" :key="item.id" @tap="toDetail(item)">
			<view class="common-card-top">
				<view class="">
					处方名称：{{item.name || '--'}}
				</view>
				<view class="common-card-top-desc">
					处方编号： {{item.id ? 'NO'+item.id :'--' }}
				</view>
			</view>
			<view class="page-box-card-bottom">
				<view class="left-right">
					<!-- <view class="left">
						退款中/已退款
					</view> -->
					<view class="right">
						<u-button shape="circle" :custom-style="buttonStyle" @click="useHandle(item)"
							hover-class="none">使用该处方
						</u-button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { API } from "@/config/myApi.js";
	export default {
		data() {
			return {
				dataList:[],
				// button
				buttonStyle: {
					width: "auto",
					height: "62rpx",
					padding:"0 20rpx",
					color: "#F4333C",
					borderRadius: "31rpx",
				},
				// id:uni.getStorageSync("expertItemDetail").id,
				params:{
					expertId:this.$store.state.expertId,
					page: 1,
					rows: 10,
				},
			};
		},
		onLoad() {
			this.getPrescriptionPagelist(this.params);
			// console.log('详情',this.id);
		},
		methods:{
			// 获取数据
			getPrescriptionPagelist(pram){
				API.prescriptionPagelist(pram).then(res => {
					if(res.code === 200) {
						this.dataList = res.result.rows;
					console.log('处方',this.dataList);
					} else {
								uni.showToast({
									title: res.message,
									icon: "none"
								})
							}
				})
			},
			// 使用处方
			useHandle(item) {
				// console.log('保存');
				uni.setStorageSync('e-prescribingDetail',item)
				uni.navigateTo({
					url:"/pages/mine/myConsultation/inquiriesDetails"
				})
			},
			toDetail(item) {
				uni.setStorageSync('expertItemDetail',item)
				uni.navigateTo({
					url:"/pages/mine/myConsultation/prescription/detail?isShow=true"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
// 挂号区域
	.common-card {
		margin-top: 24rpx;
		padding: 28rpx 24rpx 0;
		width: 690rpx;
		// height: 373rpx;
		background: #FFFFFF;
		border-radius: 14rpx;

		&-top {
			// height: 224rpx;
			border-bottom: 1rpx solid #E3E3E3;

			>view {
				margin-bottom: 28rpx;
			}
			&-desc{
				font-size: 26rpx;
				font-weight: 500;
				color: #666666;
			}
		}
	}
	// 单个区域-公共样式
	.page-box-card-bottom {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		height: 118rpx;
		padding: 30rpx 0;
	
	}
</style>
